Skip to content

feat: Android litert version bump and 16KB page support #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrew-schenk
Copy link
Contributor

This PR fixes an issue where the Google Play Store would complain that this library was bundling non 16KB page aligned .so files.

Specifically

  • base/lib/x86_64/libtensorflowlite_gpu_jni.so
  • base/lib/x86_64/libtensorflowlite_jni.so

v1.4.0 of the litert fixes that without requiring a major update to v2.
google-ai-edge/LiteRT#43

Simply updating the dependency version wasn't enough because the directory structure of litert changes from 1.0.1 to 1.4.0

You can see that by going to maven and downloading and unzipping the 1.0.1 AAR and 1.4.0 AAR.

1.0.1 directory structure

headers/
--tensorflow/
----lite/

1.4.0 directory structure

headers/
--external/
----org_tensorflow/
----tensorflow/
--tflite/

This change in directory structure requires updated imports in this projects cpp files. from #include <tensorflow/lite to #include <tflite

There was also an issue with the internal litert cpp files not linking correctly because of the extra external/org_tensorflow/tensorflow path and the way this project copies over header files. I modified the gradle script to copy tensorflow up two levels

so this: turns into
headers/
--external/
----org_tensorflow/
----tensorflow/
--tflite/

this
headers/
--tensorflow/
--tflite/

@mrousavy
Copy link
Owner

mrousavy commented Jul 7, 2025

Is this written with AI? 😄

Did you test this change if everything runs on both iOS + Android?

@andrew-schenk
Copy link
Contributor Author

Parts of the gradle step were AI generated and then refined by myself. I tested on Android with the app I am working on and the ML model I am using was still working correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants